package doing;

public class Person extends Thread{
	private static final int DELAY=45000;

	private Monitor monitor;

	public Person(Monitor m) {
		monitor = m;
	}
	
	public void run() {
		while (true) {
			try {
				sleep( (int)(Math.random()*DELAY) );
			} catch (InterruptedException e) {e.printStackTrace();}
			
			int onfloor = (int)(Math.random()*7);
			int tofloor = (int)(Math.random()*6);
			tofloor += tofloor>=onfloor?1:0;
			
			monitor.waitForElevator(onfloor, tofloor);
		}
	}
}
